package com.zzsy.shoppingpro.home.fragment.fragmentNavigator;

import android.support.v4.app.Fragment;
import com.zzsy.shoppingpro.community.fragment.CommunityFragment;
import com.zzsy.shoppingpro.home.fragment.HomeFragment;
import com.zzsy.shoppingpro.shoppingcart.fragment.ShoppingCartFragment;
import com.zzsy.shoppingpro.type.framgent.TypeFragment;
import com.zzsy.shoppingpro.user.framgent.UserFragment;

/**
 * 首页 fragment
 * Created on 2016/5/16.
 */
public class HomeNavigatorAdapter implements FragmentNavigatorAdapter {

    public HomeNavigatorAdapter() {
    }

    @Override
    public Fragment onCreateFragment(int position) {
        Fragment fragment;
        switch (position) {
            case 0:
                fragment = new HomeFragment();
                break;
            case 1:
                fragment = new TypeFragment();
                break;
           case 2:
                fragment = new CommunityFragment();
                break;
            case 3:
                fragment = new ShoppingCartFragment();
                break;
            case 4:
                fragment = new UserFragment();
                break;

            default:
                fragment = new HomeFragment();
                break;
        }

        return fragment;
    }

    @Override
    public String getTag(int position) {
        String tag;
        switch (position) {
            case 0:
                tag = HomeFragment.class.getSimpleName();
                break;
            case 1:
                tag = TypeFragment.class.getSimpleName();
                break;
            case 2:
                tag = CommunityFragment.class.getSimpleName();
                break;
            case 3:
                tag = ShoppingCartFragment.class.getSimpleName();
                break;
            case 4:
                tag = UserFragment.class.getSimpleName();
                break;

            default:
                tag = HomeFragment.class.getSimpleName();
                break;
        }
        return tag;
    }

    @Override
    public int getCount() {
        return 5;
    }
}
